package cn.jszx.core.service;

import cn.jszx.core.bean.Test;
import cn.jszx.core.dao.TestDao;
import cn.jszx.core.query.TestQuery;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by karakapi on 15-9-16.
 */
@Service
@Transactional
public class TestServiceImpl implements TestService {
    @Resource
    TestDao testDao;

    /**
     * 基本插入
     *
     * @return
     */

    public Integer addTest(Test test) {
        return testDao.addTest(test);
    }

    /**
     * 根据主键查询
     */
    @Transactional(readOnly = true)
    public Test getTestByKey(String id) {
        return testDao.getTestByKey(id);
    }

    /**
     * 根据主键批量查询
     */
    @Transactional(readOnly = true)
    public List<Test> getTestsByKeys(List<String> idList) {
        return testDao.getTestsByKeys(idList);
    }

    /**
     * 根据主键删除
     *
     * @return
     */
    public Integer deleteByKey(String id) {
        return testDao.deleteByKey(id);

    }

    /**
     * 根据主键批量删除
     *
     * @return
     */
    public Integer deleteByKeys(List<String> idList) {
        return testDao.deleteByKeys(idList);

    }

    /**
     * 根据主键更新
     *
     * @return
     */
    public Integer updateTestByKey(Test test) {
        return testDao.updateTestByKey(test);

    }


    /**
     * 根据条件查询
     *
     * @param testQuery 查询条件
     * @return
     */
    @Transactional(readOnly = true)
    public List<Test> getTestList(TestQuery testQuery) {
        return testDao.getTestList(testQuery);
    }
}
